<me:UIWB19 x:Class="WPFExcelReport.TWB19DC"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    xmlns:HR="clr-namespace:WPFExcelReport;assembly=THRSTAMM"  
                   x:Name="TV"
                     FTAUTOSUM="True"
                    SKEY1="WBFVERSION" 
                     KEY1="WBFLGVON"   
                    FontSize="14" 
                    Loaded="Window_Loaded"
     >
    <me:UIWB19.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:SDKEYCONV x:Key="sd"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
    </me:UIWB19.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition> 
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        
        <WrapPanel>
            <Button   Click="NewCommand" Height="30"  Margin="5,0,0,0" Width="30" VerticalAlignment="Center" >
                <Button.Background>
                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                </Button.Background>
            </Button>
            <Button   Click="DeleteCommand" Height="30"  Margin="5,0,0,0" Width="30" VerticalAlignment="Center" >
                <Button.Background>
                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                </Button.Background>
            </Button>
            <WrapPanel>               
                <TextBlock Text="{Binding Source={Localization:Translate Word=挡车工:}}"  Height="30" Visibility="Collapsed"/>
                <HR:TSWR WEAVER="{Binding WEAVER,ElementName=TV}"
                         EXAUF="{Binding WBFQPKT,ElementName=TV}"
                           Height="30"
                         Visibility="Collapsed"
                         IsEdit="True"/>
                <ex:TXT72 Text="{Binding WBFQPKT,ElementName=TV}"   Width="60"  Height="30" Visibility="Collapsed"/>
                <TextBlock Visibility="Collapsed" Text="{Binding WBFFILLER,Converter={StaticResource gb2312}}"  Width="100"   Height="30"/>
                <WrapPanel>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=产量:}}"  Height="30"  />
                    <ex:TXT72 Text="{Binding WBFLGVON ,Converter={StaticResource d1000}}"    Width="60" Height="30" />
                    <Button   Click="SaveCommand" Height="30"  Margin="5,0,0,0" Width="30" VerticalAlignment="Center" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                    <Button   Click="DownCommand" Height="30"  Margin="5,0,0,0" Width="30" VerticalAlignment="Center" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/arrow-up.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </WrapPanel>
        </WrapPanel>
        <WrapPanel Grid.Row="1">
            <TextBlock FontSize="16" Text="{Binding Source={Localization:Translate Word=产量:}}"  Margin="20,0,0,0"></TextBlock>
            <TextBlock FontSize="16" Text="{Binding SUM1,Converter={StaticResource d1000}}"   Margin="20,0,0,0"/> 
        </WrapPanel>
        <DataGrid  Grid.Row="2"   
                   Visibility="{Binding IsKEY,ElementName=TV,Converter={StaticResource nbv}}"
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"   
                   RowHeight="28"
                   RowDetailsVisibilityMode="Visible"  Margin="0,0,0,0"
                    >
            <DataGrid.Columns> 
                <DataGridTextColumn Binding="{Binding Path=WBFFPOS}" Header="{Binding Source={Localization:Translate Word=序号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WBFLGBIS,Converter={StaticResource sd},ConverterParameter=9318}" Header="班"  Width="30" />
                <DataGridTextColumn Binding="{Binding Path=WBFQPKT}" Header="{Binding Source={Localization:Translate Word=挡车工}}"  Width="auto" />
                <DataGridTextColumn Binding="{Binding Path=WBFFILLER,Converter={StaticResource gb2312}}" Header="挡车工"  Width="60" />
                <DataGridTextColumn Binding="{Binding Path=WBFLGVON,Converter={StaticResource d1000}}" Header="{Binding Source={Localization:Translate Word=产量}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  >
        <ListBox Grid.Row="2"   
                 Visibility="{Binding IsKEY,ElementName=TV,Converter={StaticResource bv}}"
                    ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}"   
                                ScrollViewer.CanContentScroll="True">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel  MaxWidth="600"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate> 
                    <WrapPanel Width="Auto"> 
                        <WrapPanel>
                            <TextBlock  Text="{Binding Source={Localization:Translate Word=挡车工:}}"/>
                            <TextBlock  Text="{Binding Path=WBFQPKT}"/> 
                            <TextBlock  Text="{Binding Path=WBFFILLER,Converter={StaticResource gb2312}}" Width="80"/>
                        </WrapPanel> 
                        <WrapPanel>
                            <TextBlock  Text="{Binding Source={Localization:Translate Word=产量:}}"/>
                            <TextBlock  Text="{Binding Path=WBFLGVON,Converter={StaticResource d1000}}" Margin="0,0,10,0"/>
                        </WrapPanel>
                    </WrapPanel>

                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
    </Grid>
</me:UIWB19>
